



/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.io.IOException;

/**
 * @author Dancingwithdeath
 */
public class FlipFlopDesign {

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Image element1;
    private Sprite pct1;
    public int pct1seq001Delay = 200;
    public int[] pct1seq001 = {0, 0, 0, 0, 0};
    public int pct1actDelay = 200;
    public int[] pct1act = {1, 0};
    private Image element2;
    private Sprite pct2;
    public int pct2seq001Delay = 200;
    public int[] pct2seq001 = {0, 0, 0, 0, 0};
    public int pct2actDelay = 200;
    public int[] pct2act = {0, 1};
    private Image element3;
    private Sprite pct3;
    public int pct3seq001Delay = 200;
    public int[] pct3seq001 = {0, 0, 0, 0, 0};
    public int pct3actDelay = 200;
    public int[] pct3act = {0, 1};
    private Image element4;
    private Sprite pct4;
    public int pct4seq001Delay = 200;
    public int[] pct4seq001 = {0, 0, 0, 0, 0};
    public int pct4actDelay = 200;
    public int[] pct4act = {0, 1};
    private Image element5;
    private Sprite pct5;
    public int pct5seq001Delay = 200;
    public int[] pct5seq001 = {0, 0, 0, 0, 0};
    public int pct5actDelay = 200;
    public int[] pct5act = {0, 1};
    private Image element6;
    private Sprite pct6;
    public int pct6seq001Delay = 200;
    public int[] pct6seq001 = {0, 0, 0, 0, 0};
    public int pct6actDelay = 200;
    public int[] pct6act = {0, 1};
    private Image фон;
    private TiledLayer BackGround;
    //</editor-fold>//GEN-END:|fields|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    public Image getElement1() throws java.io.IOException {//GEN-BEGIN:|1-getter|0|1-preInit
        if (element1 == null) {//GEN-END:|1-getter|0|1-preInit
            // write pre-init user code here
            element1 = Image.createImage("/resource/element1.png");//GEN-BEGIN:|1-getter|1|1-postInit
        }//GEN-END:|1-getter|1|1-postInit
        // write post-init user code here
        return this.element1;//GEN-BEGIN:|1-getter|2|
    }
//GEN-END:|1-getter|2|

    public Sprite getPct1() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
        if (pct1 == null) {//GEN-END:|2-getter|0|2-preInit
            // write pre-init user code here
            pct1 = new Sprite(getElement1(), 66, 67);//GEN-BEGIN:|2-getter|1|2-postInit
            pct1.setFrameSequence(pct1seq001);//GEN-END:|2-getter|1|2-postInit
            // write post-init user code here
        }//GEN-BEGIN:|2-getter|2|
        return pct1;
    }
//GEN-END:|2-getter|2|

    public Image getElement2() throws java.io.IOException {//GEN-BEGIN:|5-getter|0|5-preInit
        if (element2 == null) {//GEN-END:|5-getter|0|5-preInit
            // write pre-init user code here
            element2 = Image.createImage("/resource/element2.png");//GEN-BEGIN:|5-getter|1|5-postInit
        }//GEN-END:|5-getter|1|5-postInit
        // write post-init user code here
        return this.element2;//GEN-BEGIN:|5-getter|2|
    }
//GEN-END:|5-getter|2|

    public Sprite getPct2() throws java.io.IOException {//GEN-BEGIN:|6-getter|0|6-preInit
        if (pct2 == null) {//GEN-END:|6-getter|0|6-preInit
            // write pre-init user code here
            pct2 = new Sprite(getElement2(), 67, 66);//GEN-BEGIN:|6-getter|1|6-postInit
            pct2.setFrameSequence(pct2seq001);//GEN-END:|6-getter|1|6-postInit
            // write post-init user code here
        }//GEN-BEGIN:|6-getter|2|
        return pct2;
    }
//GEN-END:|6-getter|2|

    public Image getElement3() throws java.io.IOException {//GEN-BEGIN:|9-getter|0|9-preInit
        if (element3 == null) {//GEN-END:|9-getter|0|9-preInit
            // write pre-init user code here
            element3 = Image.createImage("/resource/element3.png");//GEN-BEGIN:|9-getter|1|9-postInit
        }//GEN-END:|9-getter|1|9-postInit
        // write post-init user code here
        return this.element3;//GEN-BEGIN:|9-getter|2|
    }
//GEN-END:|9-getter|2|

    public Sprite getPct3() throws java.io.IOException {//GEN-BEGIN:|10-getter|0|10-preInit
        if (pct3 == null) {//GEN-END:|10-getter|0|10-preInit
            // write pre-init user code here
            pct3 = new Sprite(getElement3(), 67, 68);//GEN-BEGIN:|10-getter|1|10-postInit
            pct3.setFrameSequence(pct3seq001);//GEN-END:|10-getter|1|10-postInit
            // write post-init user code here
        }//GEN-BEGIN:|10-getter|2|
        return pct3;
    }
//GEN-END:|10-getter|2|

    public Image getElement4() throws java.io.IOException {//GEN-BEGIN:|13-getter|0|13-preInit
        if (element4 == null) {//GEN-END:|13-getter|0|13-preInit
            // write pre-init user code here
            element4 = Image.createImage("/resource/element4.png");//GEN-BEGIN:|13-getter|1|13-postInit
        }//GEN-END:|13-getter|1|13-postInit
        // write post-init user code here
        return this.element4;//GEN-BEGIN:|13-getter|2|
    }
//GEN-END:|13-getter|2|

    public Sprite getPct4() throws java.io.IOException {//GEN-BEGIN:|14-getter|0|14-preInit
        if (pct4 == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            pct4 = new Sprite(getElement4(), 67, 65);//GEN-BEGIN:|14-getter|1|14-postInit
            pct4.setFrameSequence(pct4seq001);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return pct4;
    }
//GEN-END:|14-getter|2|

    public Image getElement5() throws java.io.IOException {//GEN-BEGIN:|17-getter|0|17-preInit
        if (element5 == null) {//GEN-END:|17-getter|0|17-preInit
            // write pre-init user code here
            element5 = Image.createImage("/resource/element5.png");//GEN-BEGIN:|17-getter|1|17-postInit
        }//GEN-END:|17-getter|1|17-postInit
        // write post-init user code here
        return this.element5;//GEN-BEGIN:|17-getter|2|
    }
//GEN-END:|17-getter|2|

    public Sprite getPct5() throws java.io.IOException {//GEN-BEGIN:|18-getter|0|18-preInit
        if (pct5 == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            pct5 = new Sprite(getElement5(), 67, 65);//GEN-BEGIN:|18-getter|1|18-postInit
            pct5.setFrameSequence(pct5seq001);//GEN-END:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return pct5;
    }
//GEN-END:|18-getter|2|

    public Image getElement6() throws java.io.IOException {//GEN-BEGIN:|21-getter|0|21-preInit
        if (element6 == null) {//GEN-END:|21-getter|0|21-preInit
            // write pre-init user code here
            element6 = Image.createImage("/resource/element6.png");//GEN-BEGIN:|21-getter|1|21-postInit
        }//GEN-END:|21-getter|1|21-postInit
        // write post-init user code here
        return this.element6;//GEN-BEGIN:|21-getter|2|
    }
//GEN-END:|21-getter|2|

    public Sprite getPct6() throws java.io.IOException {//GEN-BEGIN:|22-getter|0|22-preInit
        if (pct6 == null) {//GEN-END:|22-getter|0|22-preInit
            // write pre-init user code here
            pct6 = new Sprite(getElement6(), 67, 65);//GEN-BEGIN:|22-getter|1|22-postInit
            pct6.setFrameSequence(pct6seq001);//GEN-END:|22-getter|1|22-postInit
            // write post-init user code here
        }//GEN-BEGIN:|22-getter|2|
        return pct6;
    }
//GEN-END:|22-getter|2|

    public Image getФон() throws java.io.IOException {//GEN-BEGIN:|25-getter|0|25-preInit
        if (фон == null) {//GEN-END:|25-getter|0|25-preInit
            // write pre-init user code here
            фон = Image.createImage("/resource/фон.png");//GEN-BEGIN:|25-getter|1|25-postInit
        }//GEN-END:|25-getter|1|25-postInit
        // write post-init user code here
        return this.фон;//GEN-BEGIN:|25-getter|2|
    }
//GEN-END:|25-getter|2|



    public void updateLayerManagerForPole1(LayerManager lm) throws java.io.IOException {//GEN-LINE:|27-updateLayerManager|0|27-preUpdate
        // write pre-update user code here
        getPct2().setPosition(332, 421);//GEN-BEGIN:|27-updateLayerManager|1|27-postUpdate
        getPct2().setVisible(true);
        lm.append(getPct2());
        getPct3().setPosition(262, 420);
        getPct3().setVisible(true);
        lm.append(getPct3());
        getPct1().setPosition(194, 421);
        getPct1().setVisible(true);
        lm.append(getPct1());
        getBackGround().setPosition(4, 7);
        getBackGround().setVisible(true);
        lm.append(getBackGround());//GEN-END:|27-updateLayerManager|1|27-postUpdate
        // write post-update user code here
    }//GEN-BEGIN:|27-updateLayerManager|2|
//GEN-END:|27-updateLayerManager|2|

    public TiledLayer getBackGround() throws java.io.IOException {//GEN-BEGIN:|44-getter|0|44-preInit
        if (BackGround == null) {//GEN-END:|44-getter|0|44-preInit
            // write pre-init user code here
            BackGround = new TiledLayer(6, 7, getФон(), 66, 69);//GEN-BEGIN:|44-getter|1|44-midInit
            int[][] tiles = {
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 },
                { 1, 1, 1, 1, 1, 1 }
            };//GEN-END:|44-getter|1|44-midInit
            // write mid-init user code here
            for (int row = 0; row < 7; row++) {//GEN-BEGIN:|44-getter|2|44-postInit
                for (int col = 0; col < 6; col++) {
                    BackGround.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|44-getter|2|44-postInit
        // write post-init user code here
        return BackGround;//GEN-BEGIN:|44-getter|3|
    }
//GEN-END:|44-getter|3|

public void updateLayerManagerForForest(LayerManager lm) throws java.io.IOException {                                              
        // write pre-update user code here
		getPct1().setPosition(55, 43);                                                
		getPct1().setVisible(true);
		lm.append(getPct1());
                getPct1().setPosition(0, 0);
                lm.append(getPct1());
                getBackGround().setPosition(0,0);
                getBackGround().setVisible(true);
                lm.append(getBackGround());
		
	}

}
